package com.zyh.controller;

import com.zyh.entity.Anime;
import com.zyh.service.AnimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/anime")
public class AnimeController {
    @Autowired
    private AnimeService service;

    @RequestMapping("/insert")
    @ResponseBody
    public void insert(Anime anime){
        service.insert(anime);
    }

    @RequestMapping("/deleteById")
    @ResponseBody
    public void deleteById(Integer id){
        service.deleteById(id);
    }

    @RequestMapping("/deleteMany")
    @ResponseBody
    public void deleteMany(Integer[] ids){
        service.deleteMany(ids);
    }

    @RequestMapping("/updateById")
    @ResponseBody
    public void updateById(Anime anime){
        service.updateById(anime);
    }

    @RequestMapping("/selectById")
    @ResponseBody
    public Anime selectById(Integer id){
        return service.selectById(id);
    }

    @RequestMapping("/selectAll")
    @ResponseBody
    public List<Anime> selectAll(){
        return service.selectAll();
    }
}
